﻿/*
    JQuery Plugin - custom jQuery method
*/

$.fn.appendHtml = function (destId, appendId) {
    $(destId).append('<div>Add Text: ' + $(appendId).html() + '</div>');
};

/*
    JQuery Plugin - custom jQuery function
*/

$.appendHtml = function(destId, appendId) {
    $(destId).append('<div>Append: ' + $(appendId).html() + '</div>');
};

/*
    Plugin Option
*/

$.fn.pulse = function (options) {
    // Merge passed options with defaults
    var opts = $.extend({}, $.fn.pulse.defaults, options);
    return this.each(function () {
        // Pulse
        for (var i = 0; i < opts.pulses; i++) {
            $(this).fadeTo(opts.speed, opts.fadeLow).fadeTo(opts.speed, opts.fadeHigh);
        }
        // Reset to normal
        $(this).fadeTo(opts.speed, 1);
    });
};
// Pulse plugin default options
$.fn.pulse.defaults = {
    speed: "slow",
    pulses: 2,
    fadeLow: 0.2,
    fadeHigh: 1
};


